var app = getApp();

Page({
    data: {
        navH: app.globalData.navHeight,
        init: !1,
        content: ""
    },
    navBack: function() {
        app.globalData.from_act ? app.goIndex() : wx.navigateBack();
    },
    toIndex: function() {
        wx.switchTab({
            url: "../index/index"
        });
    },
    onLoad: function(t) {
        var a = this;
        app.util.request({
            url: "entry/wxapp/Setting",
            data: {
                name: "jd_open,tb_open,phis_share_pic,phis_share_title,share_title,share_pic"
            },
            showLoading: !1,
            success: function(t) {
                t = t.data.data, a.setData(t), a.setData({
                    init: !0
                });
            }
        }), void 0 !== t.content && a.setData({
            content: decodeURIComponent(t.content)
        });
    },
    toTrendMain: function() {
        var t;
        app.globalData.userInfo ? (t = this.data.content || "https://item.m.jd.com/product/72057620449.html", 
        wx.navigateTo({
            url: "trend-main?content=" + encodeURIComponent(t)
        })) : app.checkLogin();
    },
    setContent: function(t) {
        this.setData({
            content: t.detail.value
        });
    },
    clearC: function(t) {
        console.log(t), this.setData({
            content: ""
        });
    },
    loginAfter: function(t) {
        app.loginAfter(t);
    },
    loginCancel: function() {
        app.loginCancel();
    },
    toTrendStep: function() {
        wx.navigateTo({
            url: "trend-step"
        });
    },
    onReady: function() {},
    onShow: function() {
        app.reUserInfo();
        var a = this;
        a.data.init && wx.getClipboardData({
            success: function(t) {
                t.data && " " != t.data && a.setData({
                    content: t.data
                }, function() {
                    wx.setClipboardData({
                        data: " ",
                        success: function() {
                            wx.hideLoading();
                        }
                    });
                });
            }
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareTimeline: function() {
        var t = this, a = void 0 !== app.globalData.userInfo.uid ? "from_uid=" + app.globalData.userInfo.uid + "&from_act=share" : "from_act=share";
        return {
            title: t.data.phis_share_title || t.data.share_title,
            imageUrl: t.data.phis_share_pic || t.data.share_pic,
            query: a
        };
    },
    onShareAppMessage: function() {
        var t = (a = this).data.phis_share_title || a.data.share_title, a = a.data.phis_share_pic || a.data.share_pic;
        return {
            title: t,
            path: "/first_duoduoke/pages/trend/trend" + (void 0 !== app.globalData.userInfo.uid ? "?from_uid=" + app.globalData.userInfo.uid + "&from_act=share" : "?from_act=share"),
            imageUrl: a,
            success: function(t) {
                "shareAppMessage:ok" == t.errMsg ? wx.showToast({
                    title: "分享成功",
                    icon: "success"
                }) : wx.showToast({
                    title: "分享失败",
                    icon: "none"
                });
            },
            fail: function(t) {
                "shareAppMessage:fail cancel" == t.errMsg || t.errMsg, wx.showToast({
                    title: "分享失败",
                    icon: "none"
                });
            }
        };
    }
});